﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace AcademiaInteligenteWeb
{
    public partial class MainAcademia : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                grdAcademia.DataKeyNames = new string[] { "id" };
                AtualizarGrid();
            }
        }

        protected void lnkExcluir_Click(object sender, EventArgs e)
        {
            new WsAcademiaInteligente.WsAcademiaInteligenteSoapClient().ExcluirAcademia(Convert.ToInt32(hfCurrentItem.Value));
            AtualizarGrid();
        }
        protected void lnkAlterar_Click(object sender, EventArgs e)
        {
            Response.Redirect("NewAcademia.aspx?id=" + hfCurrentItem.Value);
        }
        public void AtualizarGrid()
        {
            grdAcademia.DataSource = new WsAcademiaInteligente.WsAcademiaInteligenteSoapClient().ListarAcademia();
            grdAcademia.DataBind();
        }

    }
}